package view.component.monster.large_monster
{
	import enums.ColorLib;
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.monster.LMonsterMeatQualityVo;
	
	import view.component.BaseSCListView;
	import view.render.monster.LMonsterMeatListItem;
	
	
	
	/**
	 * 大型怪物详细-肉质界面
	 * @author £iang
	 * 
	 */	
	public class LMDetailMeatQualityView extends BaseSCListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 斩击标题 */
		public var cutTitle:Label;
		/** 打击标题 */
		public var beatTitle:Label;
		/** 射击标题 */
		public var shotTitle:Label;
		/** 火属性标题 */
		public var fireTitle:Label;
		/** 水属性标题 */
		public var waterTitle:Label;
		/** 雷属性标题 */
		public var thunderTitle:Label;
		/** 冰属性标题 */
		public var iceTitle:Label;
		/** 龙属性标题 */
		public var dragonTitle:Label;
		/** 眩晕值标题 */
		public var dizzyTitle:Label;
		/** 硬直标题 */
		public var fearTitle:Label;
		/** 猎虫吸取标题 */
		public var bugTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.LMONSTER_MQ_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H + 
					UISize.LMONSTER_DETAIL_TAB_AREA_H +
					UISize.LIST_TITLE_H ) * this.dpiScale;
			_scrollerMaxPage = 2;
			_firstName = "部位";
			super.initialize();
		}
		
		override protected function initializeOther():void
		{
			super.initializeOther();
			cutTitle = new Label();
			cutTitle.text = "斩击";
			cutTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( cutTitle );
			
			beatTitle = new Label();
			beatTitle.text = "打击";
			beatTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( beatTitle );
			
			shotTitle = new Label();
			shotTitle.text = "射击";
			shotTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( shotTitle );
			
			fireTitle = new Label();
			fireTitle.text = "火";
			fireTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( fireTitle );
			
			waterTitle = new Label();
			waterTitle.text = "水";
			waterTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( waterTitle );
			
			thunderTitle = new Label();
			thunderTitle.text = "雷";
			thunderTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( thunderTitle );
			
			iceTitle = new Label();
			iceTitle.text = "冰";
			iceTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( iceTitle );
			
			dragonTitle = new Label();
			dragonTitle.text = "龙";
			dragonTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( dragonTitle );
			
			dizzyTitle = new Label();
			dizzyTitle.text = "眩晕";
			dizzyTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( dizzyTitle );
			
			fearTitle = new Label();
			fearTitle.text = "硬直";
			fearTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( fearTitle );
			
			bugTitle = new Label();
			bugTitle.text = "猎虫";
			bugTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( bugTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstLabelFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstLabelFullW = UISize.MAIN_W * 0.4;
			firstTitle.width = firstLabelFullW - leftPadding;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			scollerContainer.height = UISize.LIST_TITLE_H;
			
			cutTitle.y = labelY;
			cutTitle.x = 0;
			cutTitle.width  = UISize.MAIN_W * 0.2;
			
			beatTitle.y = labelY;
			beatTitle.x = UISize.MAIN_W * 0.2;
			cutTitle.width  = UISize.MAIN_W * 0.2;
			
			shotTitle.y = labelY;
			shotTitle.x = UISize.MAIN_W * 0.4;
			shotTitle.width  = UISize.MAIN_W * 0.2;
			
			dizzyTitle.y = labelY;
			dizzyTitle.x = UISize.MAIN_W * 0.6;
			dizzyTitle.width  = UISize.MAIN_W * 0.2;
			
			fearTitle.y = labelY;
			fearTitle.x = UISize.MAIN_W * 0.8;
			fearTitle.width  = UISize.MAIN_W * 0.2;
			
			bugTitle.y = labelY;
			bugTitle.x = UISize.MAIN_W;
			bugTitle.width  = UISize.MAIN_W * 0.2;
			
			fireTitle.y = labelY;
			fireTitle.x = UISize.MAIN_W * 1.2;
			fireTitle.width  = UISize.MAIN_W * 0.12;
			
			waterTitle.y = labelY;
			waterTitle.x = UISize.MAIN_W * 1.32;
			waterTitle.width  = UISize.MAIN_W * 0.12;
			
			thunderTitle.y = labelY;
			thunderTitle.x = UISize.MAIN_W * 1.44;
			thunderTitle.width  = UISize.MAIN_W * 0.12;
			
			iceTitle.y = labelY;
			iceTitle.x = UISize.MAIN_W * 1.56;
			iceTitle.width  = UISize.MAIN_W * 0.12;
			
			dragonTitle.y = labelY;
			dragonTitle.x = UISize.MAIN_W * 1.68;
			dragonTitle.width  = UISize.MAIN_W * 0.12;
			
			var buttonY:Number = ( UISize.LIST_TITLE_H * this.dpiScale - leftButton.height ) / 2;
			
			leftButton.x = firstLabelFullW - leftButton.width;
			leftButton.y = buttonY;
			
			rightButton.x = UISize.MAIN_W - leftButton.width;
			rightButton.y = buttonY;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * @param bMeat 狂化肉质
		 * 
		 */		
		public function setListData( dataVec:Vector.<LMonsterMeatQualityVo>, bMeat:int ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:LMonsterMeatListItem = new LMonsterMeatListItem();
				var tmpData:LMonsterMeatQualityVo = dataVec[ i ] as LMonsterMeatQualityVo;

				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}

			list.dataProvider = _listData;
			
			if ( bMeat >= 0 )
				firstTitle.text += '<font color="#' + ColorLib.BERSERKER.toString( 16 ) + '">(狂化+' + bMeat + ')</font>';				
			else if ( bMeat > -99 )
				firstTitle.text += '<font color="#' + ColorLib.BERSERKER.toString( 16 ) + '">(狂化' + bMeat + ')</font>';
		}
	
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"cut", "beat", "shot",
				"fire", "water", "thunder", 
				"ice", "dragon", "dizzy",
				"fear", "bug"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMDetailMeatQualityView()
		{
			super();
		}
	}
}